package com.example.demo.controller;

import com.example.demo.entity.ResultMsg;
import com.example.demo.service.ProductService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("product")
public class ProductController {
    @Resource
    private ProductService productService;

    @GetMapping("detail")
    public ResultMsg detail(Long productId) {
        return productService.detail(productId);
    }

    @PostMapping("updateStore")
    public ResultMsg updateStore(@RequestParam Long productId,
                                 @RequestParam int amount) {
        return productService.updateStore(productId, amount);
    }
}
